package com.liangzhong.proxy.rankinglist
{
	import com.common.utils.Debug;
	import com.liangzhong.constants.HttpRequestConst;
	import com.liangzhong.errortip.ErrorTips;
	import com.liangzhong.model.AppData;
	import com.liangzhong.proxy.BaseProxy;
	import com.liangzhong.proxy.ProxyUtils;
	import com.liangzhong.proxyconstant.rankinglist.RankinglistConstant;
	import com.socket.clientsocket.IClientSocket;
	
	import flash.net.URLVariables;
	import flash.utils.ByteArray;

	/**
	 *排行榜 
	 * @author Administrator
	 * 
	 */	
	public class RankinglistProxy extends BaseProxy
	{
		public static const PROXYNAME:String = "RankinglistProxy_proxyname";
		public function RankinglistProxy(proxyName:String=PROXYNAME, data:Object=null)
		{
			super(proxyName, data);
		}
		/**
		 *接受 
		 * @param mainCmdID
		 * @param subCmdID
		 * @param buffer
		 * @param dataSize
		 * @param clientSocket
		 * @return 
		 * 
		 */		
		override public function onSocketRead(mainCmdID:uint, subCmdID:uint, buffer:ByteArray, dataSize:int, clientSocket:IClientSocket):Boolean
		{
			switch(mainCmdID)
			{
				
			}
			return false;
		}
		
		/**
		 *请求排名信息 
		 * @param $obj
		 * 
		 */		
		public function requestRankDate($obj:Object):void
		{
			var variables:URLVariables = ProxyUtils.instance.getUrlVariables();
			variables.method = HttpRequestConst.RANKINGLISTDATE;
			variables.type = $obj.type;
			ProxyUtils.instance.webClient(getRankDate,variables,false);
		}
		/**
		 *返回排名信息 
		 * @param $date
		 * 
		 */
		private function getRankDate($data:Object):void
		{
			var obj:Object = ProxyUtils.instance.analysisHttpData($data,RankinglistProxy);
			if(obj.retcode == 0)
			{
				AppData.getInstance().rankingListDateManager.analysisRankingInfo(obj)
				this.sendNotification(RankinglistConstant.GET_RANKING_INFO_BY_TYPE);
			}else
			{
				Debug.echo("++++++++"+ErrorTips.instance.getErrorTip(obj.msg));
			}
		}
	}
}